package cn.xutingyin.mycat.controller;

import cn.xutingyin.mycat.entity.User;
import cn.xutingyin.mycat.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description: 用户操作控制器
 * @Author: tingyin.xu
 * @CreateDate: 2021/11/23 16:57
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("list")
    public List<User> getList() {
        return userService.getList();
    }

    @PostMapping("selectAll")
    public List<User> selectAll() {
        return userService.getList();
    }

    @PostMapping("save")
    public int save(@RequestBody User user) {
        return userService.addUser(user);
    }
}
